package com.google.adwords.samples.disapproved.auth;

import com.google.adwords.samples.disapproved.Config;
import com.google.adwords.samples.disapproved.Constants;

import org.apache.axis.client.Stub;

import java.rmi.Remote;

/**
 * Standard Login Interface for AdWords customers
 * @author alecmgo@gmail.com (Alec Go)
 *
 */
public class LoginStandard implements LoginInterface {
  public Remote setHeaders(Remote service, String clientEmail, Config config) {
    Stub stub = (Stub) service;
    stub.clearHeaders();
    String version = Constants.SERVICE_NAMESPACE_PREFIX + config.getVersion();
    stub.setHeader(version, "email", config.getEmail());
    stub.setHeader(version, "password", config.getPassword());
    stub.setHeader(version, "developerToken", config.getDeveloperToken());
    stub.setHeader(version, "applicationToken", config.getApplicationToken());
    stub.setHeader(version, "useragent", config.getUserAgent());
    stub.setHeader(version, "clientEmail", clientEmail);
    return (Remote) stub;
  }
}
